Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Improvements #1551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theoparis
Copy link

@theoparis theoparis commented Nov 30, 2024

I added a cmake install target that installs the libraries, headers and the CLI binaries to CMAKE_INSTALL_PREFIX.

This is how I built and installed luau with this PR (on a linux machine):

cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja -DCMAKE_INSTALL_PREFIX=$PWD/build/install
cmake --build build
cmake --install build

Differences from #926 and #1317:
I added a step in the CMakeLists.txt to install a pkgconfig file so that this can be used in other build systems (e.g. Meson). I can also add the cmake-only LuauConfig file back in, however this is still useable from other cmake projects using pkgconfig.
Additionally, I got a warning that cmake versions <3.10 were deprecated, so I bumped the minimum required cmake version to 3.10. If needed I can change this to 3.0..3.10 so that 3.0 still works.

CMake Deprecation Warning at CMakeLists.txt:7 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

The version is also detected from the latest git tag. Not sure if this is right way to automate it but it should allow installing the pkgconfig file with the correct version after a tag is created.

I also had to add JoinPaths.cmake, which could be removed if the minimum cmake version is bumped to 3.20. See https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files

@theoparis theoparis changed the title Add cmake installation target CMake Improvements Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant